﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using NeuralStock.DomainService.Interfaces;
using NeuralStock.DomainService;
using Microsoft.Practices.Unity;
using System;

namespace NeuralStock.Tests.Business
{
    [TestClass]
    public class FinancialAnalysisServiceTest
    {
        [TestMethod]
        public void CalcualteEbitReturnOnEquityCapitalVs3YearAvg_Domdev2012_ShouldReturnValidValue()
        {
            ICompanyService companyService = Bootstrapper.GetUnityContainer().Resolve<ICompanyService>();
            IFinancialAnalysisService financialAnalysisService = Bootstrapper.GetUnityContainer().Resolve<IFinancialAnalysisService>();

            var company = companyService.Get("DOMDEV");

            Assert.AreEqual(1.09896m, Math.Round(financialAnalysisService.CalculateEbitReturnOnEquityCapitalVs3YearAvg(company.Id, 2012).Value, 5));
        }

        [TestMethod]
        public void CalculateParticipationOfEquityCapitalInAssetsVs3YearAvg_Domdev2012_ShouldReturnValidValue()
        {
            ICompanyService companyService = Bootstrapper.GetUnityContainer().Resolve<ICompanyService>();
            IFinancialAnalysisService financialAnalysisService = Bootstrapper.GetUnityContainer().Resolve<IFinancialAnalysisService>();

            var company = companyService.Get("DOMDEV");

            Assert.AreEqual(1.09678m, Math.Round(financialAnalysisService.CalculateParticipationOfEquityCapitalInAssetsVs3YearAvg(company.Id, 2012).Value, 5));
        }
    }
}
